package com.zhiyou.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.zhiyou.mapper.CourseMapper;
import com.zhiyou.pojo.Course;
import com.zhiyou.pojo.CourseExample;
import com.zhiyou.pojo.CourseExample.Criteria;

@Service
public class CourseService {

	
	@Autowired
	private CourseMapper courseMapper;
	
	public List<Course> selectAll(){
		
		return courseMapper.selectByExample(new CourseExample());
	}

	public  List<Course> selectBySubejectId(int subjectId) {

	    CourseExample example=new CourseExample();
		Criteria criteria = example.createCriteria();
		criteria.andSubjectIdEqualTo(subjectId);
	    List<Course> courList = courseMapper.selectByExampleWithBLOBs(example);
		return courList;
	}

	public Course selectById(int id) {
		// TODO Auto-generated method stub
		return courseMapper.selectByPrimaryKey(id);
	}
}
